package demo;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2024-03-30
 * Time: 15:41
 */
public class Test1 {
    public static void main(String[] args) {
        LinkedList<Integer> list1 = new LinkedList<>();
        list1.add(1);
        list1.add(2);
        list1.add(3);
        list1.add(4);


        for (Integer x : list1) {
            System.out.print(x + " ");
        }
        System.out.println();

        for(int i = 0; i < list1.size(); i++) {
            System.out.print(list1.get(i)+ " ");
        }
        System.out.println();

        Iterator<Integer> it = list1.iterator();
        while(it.hasNext()) {
            System.out.print(it.next() + " ");
        }
        System.out.println();

        /*List<Integer> list2= new LinkedList<>();

        list2.add(1);
        list2.add(2);

        List<Integer> list3 = new LinkedList<>(list2);*/

















    }






}
